/*
	Header file that contains all the function prototypes for the
	 LCD control functions used
*/
#ifndef INCLUSION_GUARD_LCD_CONTROLS_H
#define INCLUSION_GUARD_LCD_CONTROLS_H

#define LCD_CS1             LATFbits.LATF0
#define LCD_CS2             LATFbits.LATF1
#define LCD_RESET           LATFbits.LATF4
#define LCD_RW              LATFbits.LATF5
#define LCD_DI              LATFbits.LATF2
#define LCD_ENABLE          LATFbits.LATF3
#define LCD_DATA            LATB

#define CHIP1               0
#define CHIP2               1
#define READ                1
#define WRITE               0
#define DATA                1
#define INSTRUCTION         0
#define ON                  1
#define OFF                 0
#define LCD_POWER(P)        (((P) ? 1:0) | 0x3E)    //LCD_POWER(ON) will give the
                                                    // instruction to turn the display on
#define LCD_STARTLINE(L)    (((L) & 0x3F) | 0xC0)
#define LCD_YADDR(Y)        (((Y) & 0x3F) | 0x40)
#define LCD_XADDR(X)        (((X) & 0x07) | 0xB8)

#define BOTH_CHIPS          2
#define SINGLE_CHIP         1
#define MULTI_LINE          1
#define SINGLE_LINE         0


//unsigned char current_y_addr;
//unsigned char current_x_addr;


void LCD_init(void);
void LCD_write_instruction(unsigned char instruction, unsigned char chip);
void LCD_write_instruction_wait(unsigned char instruction, unsigned char chip);
void LCD_write_data(unsigned char data, unsigned char chip);
void LCD_write_data_wait(unsigned char data, unsigned char chip);
void LCD_wait(unsigned char chip);
unsigned char LCD_read(unsigned char chip);
void LCD_CHIP_SEL(unsigned char chip);
void LCDenable(void);
void LCDwrite(char output[]);
void LCDaddress(unsigned char addr);
void LCD_clear(void);
void LCDhome(void);
void backspace(unsigned char addr);
void LCD_char(char character, unsigned char chip);
void LCD_char2(char character, unsigned char chip);
void LCD_partial_char(char character, unsigned char num_lines);
void LCD_string(char string[], unsigned char num_chips);
void LCD_string2(char string[], unsigned char num_chips);
void LCD_paragraph(char string[]);
int next_space_addr(char string[], unsigned char i);
void LCDchar_addr(char character, char address);
void LCD_fullscreen_picture(unsigned char pic_index);
void LCD_animate(void);

#endif